package com.learn.designPatterns.structuralType.Proxy;

/**
 * @classname:
 * @Description:
 * @author: yfpu
 * @Date: 2018-11-01 14:01
 */
public class ImageProxy implements Image{

    private HighResolutionImage highResolutionImage;

    public ImageProxy(HighResolutionImage highResolutionImage) {
        this.highResolutionImage = highResolutionImage;
    }

    @Override
    public void showImage() {
        while (!highResolutionImage.isLoad()) {
            System.out.println("Temp Image " + highResolutionImage.getWidth() + " " + highResolutionImage.getHeight());
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        highResolutionImage.showImage();
    }
}
